﻿@using SchoolPointe.Menus.Enums
@using SchoolPointe.Menus.Models
@using Orchard.ContentManagement

@{ 
    var part = ((IContent)Model.ContentItem).As<BetterMenuItemPart>();
    var description = part.MenuItemType.Description();
    string menuItemType = part.MenuItemType.ToString();
    Script.Require("MenuEditor").AtHead();   
}
        
<div class="sp-menu-collapse">
    <h4><a href="#">Add New @description</a></h4>
    <div>
        <div class="edit-form">            
            <div class="menuitem-content-item-selector">
                <select class="contentTypeSelector" multiple="multiple" style="display: none;">
                    <option value="*" selected>Any Content Type</option>
                    @foreach (Orchard.ContentManagement.MetaData.Models.ContentTypeDefinition contentType in Model.ContentTypeDefinitions)
                    {
                        <option value="@contentType.Name">@contentType.DisplayName</option>
                    }
                </select>

                <div class="content-item-selector">        
                    <div id="content-item-tab-filters">
                        <ul>
		                    <li><a class="content-item-tab-header"  href="@Url.Action("GetRecentContentByType", "MenuItemAdmin", new { area = "SchoolPointe.Menus" })?types[0]=*">Most Recent</a></li>
		                    <li><a class="content-item-tab-header"  href="@Url.Action("GetAllContentByType", "MenuItemAdmin", new { area = "SchoolPointe.Menus" })?types[0]=*">View All</a></li>
		                    <li><a class="content-item-tab-header" id="content-item-search-tab" href="@Url.Action("SearchContentByType", "MenuItemAdmin", new { area = "SchoolPointe.Menus" })?types[0]=*">Search</a></li>
	                    </ul>
                    </div>
                </div>
            </div>

            <input type="hidden" name="prefix" value="@Model.ParentPrefix" />
            @Display(Model.Child)
        </div>
        <button class="secondaryAction addContentItemMenuItems" value="@Url.Action("CreateContentItems", "MenuItemAdmin", new { area = "SchoolPointe.Menus", menuId = Model.MenuId })">Add to Menu</button>                
        <span class="ajax-indicator">Saving...</span>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        $('#content-item-tab-filters').tabs({
            cache: true
        });
    });
</script>



